<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the MantisUserProfileTable class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single MantisUserProfileTable object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a MantisUserProfileTableMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 *
	 * @package My QCubed Application
	 * @subpackage MetaControls
	 * @property-read MantisUserProfileTable $MantisUserProfileTable the actual MantisUserProfileTable data class being edited
	 * @property QLabel $IdControl
	 * @property-read QLabel $IdLabel
	 * @property QIntegerTextBox $UserIdControl
	 * @property-read QLabel $UserIdLabel
	 * @property QTextBox $PlatformControl
	 * @property-read QLabel $PlatformLabel
	 * @property QTextBox $OsControl
	 * @property-read QLabel $OsLabel
	 * @property QTextBox $OsBuildControl
	 * @property-read QLabel $OsBuildLabel
	 * @property QTextBox $DescriptionControl
	 * @property-read QLabel $DescriptionLabel
	 * @property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * @property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class MantisUserProfileTableMetaControlGen extends QBaseClass {
		// General Variables
		/**
		 * @var MantisUserProfileTable objMantisUserProfileTable
		 * @access protected
		 */
		protected $objMantisUserProfileTable;
		/**
		 * @var QForm|QControl objParentObject
		 * @access protected
		 */
		protected $objParentObject;
		/**
		 * @var string strTitleVerb
		 * @access protected
		 */
		protected $strTitleVerb;
		/**
		 * @var boolean blnEditMode
		 * @access protected
		 */
		protected $blnEditMode;

		// Controls that allow the editing of MantisUserProfileTable's individual data fields
		/**
		 * @var QLabel lblId
		 * @access protected
		 */
		protected $lblId;
		/**
		 * @var QIntegerTextBox txtUserId
		 * @access protected
		 */
		protected $txtUserId;
		/**
		 * @var QTextBox txtPlatform
		 * @access protected
		 */
		protected $txtPlatform;
		/**
		 * @var QTextBox txtOs
		 * @access protected
		 */
		protected $txtOs;
		/**
		 * @var QTextBox txtOsBuild
		 * @access protected
		 */
		protected $txtOsBuild;
		/**
		 * @var QTextBox txtDescription
		 * @access protected
		 */
		protected $txtDescription;

		// Controls that allow the viewing of MantisUserProfileTable's individual data fields
		/**
		 * @var QLabel lblUserId
		 * @access protected
		 */
		protected $lblUserId;
		/**
		 * @var QLabel lblPlatform
		 * @access protected
		 */
		protected $lblPlatform;
		/**
		 * @var QLabel lblOs
		 * @access protected
		 */
		protected $lblOs;
		/**
		 * @var QLabel lblOsBuild
		 * @access protected
		 */
		protected $lblOsBuild;
		/**
		 * @var QLabel lblDescription
		 * @access protected
		 */
		protected $lblDescription;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * MantisUserProfileTableMetaControl to edit a single MantisUserProfileTable object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single MantisUserProfileTable object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisUserProfileTableMetaControl
		 * @param MantisUserProfileTable $objMantisUserProfileTable new or existing MantisUserProfileTable object
		 */
		 public function __construct($objParentObject, MantisUserProfileTable $objMantisUserProfileTable) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this MantisUserProfileTableMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked MantisUserProfileTable object
			$this->objMantisUserProfileTable = $objMantisUserProfileTable;

			// Figure out if we're Editing or Creating New
			if ($this->objMantisUserProfileTable->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to
		 * edit, or if we are also allowed to create a new one, etc.
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisUserProfileTableMetaControl
		 * @param integer $intId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing MantisUserProfileTable object creation - defaults to CreateOrEdit
 		 * @return MantisUserProfileTableMetaControl
		 */
		public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intId)) {
				$objMantisUserProfileTable = MantisUserProfileTable::Load($intId);

				// MantisUserProfileTable was found -- return it!
				if ($objMantisUserProfileTable)
					return new MantisUserProfileTableMetaControl($objParentObject, $objMantisUserProfileTable);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a MantisUserProfileTable object with PK arguments: ' . $intId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new MantisUserProfileTableMetaControl($objParentObject, new MantisUserProfileTable());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisUserProfileTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisUserProfileTable object creation - defaults to CreateOrEdit
		 * @return MantisUserProfileTableMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::PathInfo(0);
			return MantisUserProfileTableMetaControl::Create($objParentObject, $intId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this MantisUserProfileTableMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing MantisUserProfileTable object creation - defaults to CreateOrEdit
		 * @return MantisUserProfileTableMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::QueryString('intId');
			return MantisUserProfileTableMetaControl::Create($objParentObject, $intId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QLabel lblId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblId_Create($strControlId = null) {
			$this->lblId = new QLabel($this->objParentObject, $strControlId);
			$this->lblId->Name = QApplication::Translate('Id');
			if ($this->blnEditMode)
				$this->lblId->Text = $this->objMantisUserProfileTable->Id;
			else
				$this->lblId->Text = 'N/A';
			return $this->lblId;
		}

		/**
		 * Create and setup QIntegerTextBox txtUserId
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtUserId_Create($strControlId = null) {
			$this->txtUserId = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtUserId->Name = QApplication::Translate('User Id');
			$this->txtUserId->Text = $this->objMantisUserProfileTable->UserId;
			$this->txtUserId->Required = true;
			return $this->txtUserId;
		}

		/**
		 * Create and setup QLabel lblUserId
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblUserId_Create($strControlId = null, $strFormat = null) {
			$this->lblUserId = new QLabel($this->objParentObject, $strControlId);
			$this->lblUserId->Name = QApplication::Translate('User Id');
			$this->lblUserId->Text = $this->objMantisUserProfileTable->UserId;
			$this->lblUserId->Required = true;
			$this->lblUserId->Format = $strFormat;
			return $this->lblUserId;
		}

		/**
		 * Create and setup QTextBox txtPlatform
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtPlatform_Create($strControlId = null) {
			$this->txtPlatform = new QTextBox($this->objParentObject, $strControlId);
			$this->txtPlatform->Name = QApplication::Translate('Platform');
			$this->txtPlatform->Text = $this->objMantisUserProfileTable->Platform;
			$this->txtPlatform->Required = true;
			$this->txtPlatform->MaxLength = MantisUserProfileTable::PlatformMaxLength;
			return $this->txtPlatform;
		}

		/**
		 * Create and setup QLabel lblPlatform
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblPlatform_Create($strControlId = null) {
			$this->lblPlatform = new QLabel($this->objParentObject, $strControlId);
			$this->lblPlatform->Name = QApplication::Translate('Platform');
			$this->lblPlatform->Text = $this->objMantisUserProfileTable->Platform;
			$this->lblPlatform->Required = true;
			return $this->lblPlatform;
		}

		/**
		 * Create and setup QTextBox txtOs
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtOs_Create($strControlId = null) {
			$this->txtOs = new QTextBox($this->objParentObject, $strControlId);
			$this->txtOs->Name = QApplication::Translate('Os');
			$this->txtOs->Text = $this->objMantisUserProfileTable->Os;
			$this->txtOs->Required = true;
			$this->txtOs->MaxLength = MantisUserProfileTable::OsMaxLength;
			return $this->txtOs;
		}

		/**
		 * Create and setup QLabel lblOs
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblOs_Create($strControlId = null) {
			$this->lblOs = new QLabel($this->objParentObject, $strControlId);
			$this->lblOs->Name = QApplication::Translate('Os');
			$this->lblOs->Text = $this->objMantisUserProfileTable->Os;
			$this->lblOs->Required = true;
			return $this->lblOs;
		}

		/**
		 * Create and setup QTextBox txtOsBuild
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtOsBuild_Create($strControlId = null) {
			$this->txtOsBuild = new QTextBox($this->objParentObject, $strControlId);
			$this->txtOsBuild->Name = QApplication::Translate('Os Build');
			$this->txtOsBuild->Text = $this->objMantisUserProfileTable->OsBuild;
			$this->txtOsBuild->Required = true;
			$this->txtOsBuild->MaxLength = MantisUserProfileTable::OsBuildMaxLength;
			return $this->txtOsBuild;
		}

		/**
		 * Create and setup QLabel lblOsBuild
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblOsBuild_Create($strControlId = null) {
			$this->lblOsBuild = new QLabel($this->objParentObject, $strControlId);
			$this->lblOsBuild->Name = QApplication::Translate('Os Build');
			$this->lblOsBuild->Text = $this->objMantisUserProfileTable->OsBuild;
			$this->lblOsBuild->Required = true;
			return $this->lblOsBuild;
		}

		/**
		 * Create and setup QTextBox txtDescription
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtDescription_Create($strControlId = null) {
			$this->txtDescription = new QTextBox($this->objParentObject, $strControlId);
			$this->txtDescription->Name = QApplication::Translate('Description');
			$this->txtDescription->Text = $this->objMantisUserProfileTable->Description;
			$this->txtDescription->Required = true;
			$this->txtDescription->TextMode = QTextMode::MultiLine;
			return $this->txtDescription;
		}

		/**
		 * Create and setup QLabel lblDescription
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblDescription_Create($strControlId = null) {
			$this->lblDescription = new QLabel($this->objParentObject, $strControlId);
			$this->lblDescription->Name = QApplication::Translate('Description');
			$this->lblDescription->Text = $this->objMantisUserProfileTable->Description;
			$this->lblDescription->Required = true;
			return $this->lblDescription;
		}



		/**
		 * Refresh this MetaControl with Data from the local MantisUserProfileTable object.
		 * @param boolean $blnReload reload MantisUserProfileTable from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objMantisUserProfileTable->Reload();

			if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objMantisUserProfileTable->Id;

			if ($this->txtUserId) $this->txtUserId->Text = $this->objMantisUserProfileTable->UserId;
			if ($this->lblUserId) $this->lblUserId->Text = $this->objMantisUserProfileTable->UserId;

			if ($this->txtPlatform) $this->txtPlatform->Text = $this->objMantisUserProfileTable->Platform;
			if ($this->lblPlatform) $this->lblPlatform->Text = $this->objMantisUserProfileTable->Platform;

			if ($this->txtOs) $this->txtOs->Text = $this->objMantisUserProfileTable->Os;
			if ($this->lblOs) $this->lblOs->Text = $this->objMantisUserProfileTable->Os;

			if ($this->txtOsBuild) $this->txtOsBuild->Text = $this->objMantisUserProfileTable->OsBuild;
			if ($this->lblOsBuild) $this->lblOsBuild->Text = $this->objMantisUserProfileTable->OsBuild;

			if ($this->txtDescription) $this->txtDescription->Text = $this->objMantisUserProfileTable->Description;
			if ($this->lblDescription) $this->lblDescription->Text = $this->objMantisUserProfileTable->Description;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC MANTISUSERPROFILETABLE OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's MantisUserProfileTable instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveMantisUserProfileTable() {
			try {
				// Update any fields for controls that have been created
				if ($this->txtUserId) $this->objMantisUserProfileTable->UserId = $this->txtUserId->Text;
				if ($this->txtPlatform) $this->objMantisUserProfileTable->Platform = $this->txtPlatform->Text;
				if ($this->txtOs) $this->objMantisUserProfileTable->Os = $this->txtOs->Text;
				if ($this->txtOsBuild) $this->objMantisUserProfileTable->OsBuild = $this->txtOsBuild->Text;
				if ($this->txtDescription) $this->objMantisUserProfileTable->Description = $this->txtDescription->Text;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the MantisUserProfileTable object
				$this->objMantisUserProfileTable->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's MantisUserProfileTable instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteMantisUserProfileTable() {
			$this->objMantisUserProfileTable->Delete();
		}



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'MantisUserProfileTable': return $this->objMantisUserProfileTable;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to MantisUserProfileTable fields -- will be created dynamically if not yet created
				case 'IdControl':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'IdLabel':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'UserIdControl':
					if (!$this->txtUserId) return $this->txtUserId_Create();
					return $this->txtUserId;
				case 'UserIdLabel':
					if (!$this->lblUserId) return $this->lblUserId_Create();
					return $this->lblUserId;
				case 'PlatformControl':
					if (!$this->txtPlatform) return $this->txtPlatform_Create();
					return $this->txtPlatform;
				case 'PlatformLabel':
					if (!$this->lblPlatform) return $this->lblPlatform_Create();
					return $this->lblPlatform;
				case 'OsControl':
					if (!$this->txtOs) return $this->txtOs_Create();
					return $this->txtOs;
				case 'OsLabel':
					if (!$this->lblOs) return $this->lblOs_Create();
					return $this->lblOs;
				case 'OsBuildControl':
					if (!$this->txtOsBuild) return $this->txtOsBuild_Create();
					return $this->txtOsBuild;
				case 'OsBuildLabel':
					if (!$this->lblOsBuild) return $this->lblOsBuild_Create();
					return $this->lblOsBuild;
				case 'DescriptionControl':
					if (!$this->txtDescription) return $this->txtDescription_Create();
					return $this->txtDescription;
				case 'DescriptionLabel':
					if (!$this->lblDescription) return $this->lblDescription_Create();
					return $this->lblDescription;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to MantisUserProfileTable fields
					case 'IdControl':
						return ($this->lblId = QType::Cast($mixValue, 'QControl'));
					case 'UserIdControl':
						return ($this->txtUserId = QType::Cast($mixValue, 'QControl'));
					case 'PlatformControl':
						return ($this->txtPlatform = QType::Cast($mixValue, 'QControl'));
					case 'OsControl':
						return ($this->txtOs = QType::Cast($mixValue, 'QControl'));
					case 'OsBuildControl':
						return ($this->txtOsBuild = QType::Cast($mixValue, 'QControl'));
					case 'DescriptionControl':
						return ($this->txtDescription = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>